<?php
namespace app\api\controller;

use app\api\model\Dish as DishModel;
use think\facade\Request;

class Dish
{
    public function index()
    {
        $dishes = DishModel::select();
        return json(['code' => 200, 'data' => $dishes]);
    }

    public function store()
    {
        $data = Request::post();
        $dish = new DishModel();
        $dish->save($data);
        return json(['code' => 200, 'message' => '菜品添加成功']);
    }
}
